//
//  MKTChatUserPicView.m
//  MKUITestApp
//
//  Created by 苏尚进 on 2021/7/8.
//  Copyright © 2021 moon. All rights reserved.
//

#import "MKTChatUserPicView.h"
#import <MKUI/MKUI.h>
@implementation MKTChatUserPicView
- (id)initWithFrame:(CGRect)frame{
    if (self=[super initWithFrame:frame]) {
        self.contentMode = UIViewContentModeScaleAspectFit;
        self.layer.borderColor = [UIColor whiteColor].CGColor;
        self.layer.borderWidth = 2;
        self.clipsToBounds = YES;
        [self customTraitCollection];
    }
    return self;
}
- (void)customTraitCollection{
    self.layer.borderColor = [UITraitCollection mk_isDarkStyle]?[UIColor whiteColor].CGColor:[UIColor blackColor].CGColor;
}
- (void)traitCollectionDidChange:(UITraitCollection *)previousTraitCollection{
    [super traitCollectionDidChange:previousTraitCollection];
    [self customTraitCollection];
}
- (void)layoutSubviews{
    [super layoutSubviews];
    CGRect bounds = self.bounds;
    self.layer.cornerRadius = MIN(bounds.size.width, bounds.size.height)*0.5;
}
- (CGSize)sizeThatFits:(CGSize)size{
    return CGSizeMake(37, 37);
}

@end
@implementation MKTChatUserPicViewMine
- (CGSize)sizeThatFits:(CGSize)size{
    return CGSizeMake(37, 37);
}
@end
@implementation MKTChatUserPicViewOther
- (CGSize)sizeThatFits:(CGSize)size{
    return CGSizeMake(30, 30);
}
@end

